<!DOCTYPE html>

<html>

<head>
    <meta charset="utf-8">
    <title>编辑信息体测</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">

</head>

<body ng-app="app" ng-controller="addContextController">

    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">

            <div class="layui-col-md11">

                <div class="layui-card">
                    <div class="layui-card-header"><a href="javascript:history.go(-1);">返回上一页</a>修改体质测试数据</div>
                    <div class="layui-card-body">
                        <form class="layui-form" action="" lay-filter="component-form-element" id="component-form-group">
                            <div class="layui-row layui-col-space10 layui-form-item">

                                <div class="layui-col-lg6">
                                    <label class="layui-form-label">类型选择</label>
                                    <div class="layui-input-block">


                                        <input type="text" name="conditionType" lay-verify="required" placeholder="保留两位小数" autocomplete="off" value="{{Conditioncontext.constionParent.content}}" readonly class="layui-input">
                                    </div>
                                </div>

                            </div>



                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-lg3">
                                    <label class="layui-form-label">{{Conditioncontext.constionParent.height}}</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="height" lay-verify="required" placeholder="保留两位小数" id="height" value="{{Conditioncontext.height}}" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-col-lg3">
                                    <label class="layui-form-label">{{Conditioncontext.constionParent.weight}}</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="width" lay-verify="required" id="width" value="{{Conditioncontext.weight}}" placeholder="保留两位小数" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-col-lg3">
                                    <label class="layui-form-label">{{Conditioncontext.constionParent.abduction}}</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="abduction" lay-verify="required" id="abduction" value="{{Conditioncontext.abduction}}" placeholder="保留两位小数" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-col-lg3">
                                    <label class="layui-form-label">{{Conditioncontext.constionParent.fingerSpan}}</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="fingerSpan" lay-verify="required" id="fingerSpan" value="{{Conditioncontext.fingerSpan}}" placeholder="保留两位小数" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>


                            <div class="layui-form-item">
                                <label class="layui-form-label">{{Conditioncontext.constionParent.singForward}}</label>
                                <div class="layui-input-block">
                                    <input type="text" name="singForward" placeholder="保留两位小数" id="singForward" value="{{Conditioncontext.singForward}}" lay-verify="required" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">{{Conditioncontext.constionParent.roundTrip}}</label>
                                <div class="layui-input-block">
                                    <input type="text" name="roundTrip" placeholder="整数" id="roundTrip" value="{{Conditioncontext.roundTrip}}" lay-verify="required" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">{{Conditioncontext.constionParent.courtSprint}}</label>
                                <div class="layui-input-block">
                                    <input type="text" name="courtSprint" placeholder="保留两位小数" id="courtSprint" value="{{Conditioncontext.courtSprint}}" lay-verify="required" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">{{Conditioncontext.constionParent.restrtedArea}}</label>
                                <div class="layui-input-block">
                                    <input type="text" name="restrtedArea" placeholder="保留两位小数" id="restrtedArea" value="{{Conditioncontext.restrtedArea}}" lay-verify="required" class="layui-input">
                                </div>
                            </div>


                            <div class="layui-form-item">
                                <label class="layui-form-label">{{Conditioncontext.constionParent.klingWing}}</label>
                                <div class="layui-input-block">
                                    <input type="text" name="klingWing" placeholder="保留两位小数" id="klingWing" value="{{Conditioncontext.klingWing}}" lay-verify="required" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">{{Conditioncontext.constionParent.verticalJump}}</label>
                                <div class="layui-input-block">
                                    <input type="text" name="verticalJump" placeholder="整数" id="verticalJump" value="{{Conditioncontext.verticalJump}}" lay-verify="required" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">{{Conditioncontext.constionParent.continJump}}</label>
                                <div class="layui-input-block">
                                    <input type="text" name="continJump" placeholder="整数" id="continJump" value="{{Conditioncontext.contiNump}}" lay-verify="required" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label"> 备注:</label>
                                <div class="layui-input-block">
                                    <textarea name="remake" placeholder="备注内容" lay-verify="required" id="remake" class="layui-textarea"></textarea>
                                </div>
                            </div>


                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn" type="button" lay-submit lay-filter="component-form-element">保存</button>
                                    <a class="layui-btn layui-btn-primary" href="javascript:history.go(-1);">返回</a>
                                </div>
                            </div>

                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="../../../layuiadmin/jquery/jquery-1.11.1.min.js"></script>
    <script src="../../../layuiadmin/url.js"></script>
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/jquery/angular.js"></script>
    <script>
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form'], function() {
            var $ = layui.$,
                admin = layui.admin,
                element = layui.element,
                form = layui.form;

            form.render(null, 'component-form-element');
            element.render('breadcrumb', 'breadcrumb');
            //获取url地址栏
            function getQueryVariable(variable) {
                var query = window.location.search.substring(1);
                var vars = query.split("&");
                for (var i = 0; i < vars.length; i++) {
                    var pair = vars[i].split("=");
                    if (pair[0] == variable) {
                        return pair[1];
                    }
                }
                return (false);
            }
            form.on('submit(component-form-element)', function(data) {
                var cid = getQueryVariable("cid");
                //  layer.msg(JSON.stringify(data.field));

                var height = data.field.height;
                var width = data.field.width;
                var abduction = data.field.abduction;
                var fingerSpan = data.field.fingerSpan;
                var singForward = data.field.singForward;
                var roundTrip = data.field.roundTrip;
                var courtSprint = data.field.courtSprint;
                var restrtedArea = data.field.restrtedArea;
                var klingWing = data.field.klingWing;
                var verticalJump = data.field.verticalJump;
                var continJump = data.field.continJump;
                var remake = data.field.remake;


                $.ajax({
                    type: "POST",
                    dataType: "json",
                    url: applicationUrl + 'no-constitution/api/update',
                    data: {
                        cid: cid,

                        height: height,
                        width: width,
                        abduction: abduction,
                        fingerSpan: fingerSpan,
                        singForward: singForward,
                        roundTrip: roundTrip,
                        courtSprint: courtSprint,
                        restrtedArea: restrtedArea,
                        klingWing: klingWing,
                        verticalJump: verticalJump,
                        continJump: continJump,
                        remake: remake,

                    },
                    success: function(result) {
                        layer.msg(result.msg);


                    },
                    error: function(result) {
                        layer.msg(result.msg);

                    }

                })
                return false;
            });
        });





        var app = angular.module('app', []);
        app.controller('addContextController', ['$scope', '$http', function($scope, $http) {
            //获取url地址栏
            function getQueryVariable(variable) {
                var query = window.location.search.substring(1);
                var vars = query.split("&");
                for (var i = 0; i < vars.length; i++) {
                    var pair = vars[i].split("=");
                    if (pair[0] == variable) {
                        return pair[1];
                    }
                }
                return (false);
            }

            $scope.getConditionTypeContext = function() {
                // var cid = $("#conditionType").val();
                var cid = getQueryVariable("cid");
                console.log(cid);
                if (cid != "") {
                    // $(".form-items-show").attr("style", "display:block");
                    console.log("ok");

                    $http({
                        method: 'POST',
                        url: applicationUrl + 'no-constitution/api/selectConstionParentByCid',
                        headers: {
                            "Content-Type": 'application/x-www-form-urlencoded'
                        },
                        params: {
                            cid: cid
                        },
                    }).success(function(result) {
                        $scope.Conditioncontext = result.data;
                        $("#remake").val(result.data.remake);
                    }).error(function(data, status) {
                        console.log(" ");
                    });
                } else {
                    console.log("no");
                }


            };
            $scope.getConditionTypeContext();
            $scope.updateConditionContext = function() {

                var cid = getQueryVariable("cid");
                var height = $("#height").val();
                var width = $("#width").val();
                var abduction = $("abduction").val();
                var fingerSpan = $("#fingerSpan").val();
                var singForward = $("#singForward").val();
                var roundTrip = $("#roundTrip").val();
                var courtSprint = $("#courtSprint").val();
                var restrtedArea = $("#restrtedArea").val();
                var klingWing = $("#klingWing").val();
                var verticalJump = $("#verticalJump").val();
                var remake = $("#remake").val();
                console.log(cid);
                if (cid != "") {
                    console.log("ok");
                    $http({
                        method: 'POST',
                        url: applicationUrl + 'no-constitution/api/update',
                        headers: {
                            "Content-Type": 'application/x-www-form-urlencoded'
                        },
                        params: {
                            cid: cid,

                            height: height,
                            width: width,
                            abduction: abduction,
                            fingerSpan: fingerSpan,
                            singForward: singForward,
                            roundTrip: roundTrip,
                            courtSprint: courtSprint,
                            restrtedArea: restrtedArea,
                            klingWing: klingWing,
                            verticalJump: verticalJump,
                            remake: remake,
                        },
                    }).success(function(result) {
                        $scope.getConditionTypeContext();
                    }).error(function(data, status) {
                        console.log(" ");
                    });
                } else {
                    console.log("no");
                }
            };




        }]);
    </script>
</body>

</html>